load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

package(default_visibility = ["//visibility:public"])

rust_library(
    name = "sys",
    srcs = glob(["src/**"]),
    crate_name = "ic_sys",
    version = "0.9.0",
    deps = [
        # Keep sorted.
        "//rs/crypto/sha2",
        "//rs/phantom_newtype",
        "@crate_index//:hex",
        "@crate_index//:lazy_static",
        "@crate_index//:libc",
        "@crate_index//:nix",
        "@crate_index//:prost",
        "@crate_index//:tokio",
        "@crate_index//:wsl",
    ] + select({
        "@rules_rust//rust/platform:unix": [
            "@crate_index//:rand",
        ],
        "//conditions:default": [],
    }) + select({
        "@rules_rust//rust/platform:linux": [
            "@crate_index//:cvt",
            "@crate_index//:thiserror",
        ],
        "//conditions:default": [],
    }),
)

rust_test(
    name = "sys_test",
    crate = ":sys",
    deps = [
        # Keep sorted.
        "@crate_index//:assert_matches",
        "@crate_index//:tempfile",
    ],
)
